package ex;
import java.util.Arrays;
/**
 * @author 小李要吃鱼
 * @date 2021-01-18 10:39
 */
public class Ex3 {
    public static void main(String[] args){
        int ary[] = {9,15,6,33,21};
        ary = selectionsort(ary);
        System.out.println(Arrays.toString(ary));
    }
    public static int[] selectionsort(int[] ary){
        for (int i = 0; i < ary.length - 1; i++){
            for (int j = i +1;j < ary.length ; j++){
                if (ary[i] > ary[j]){
                    int temp = ary[i];
                    ary[j] = temp;
                    ary[i] = ary[j];

                }
            }
        }
        return ary;
    }
}
